/**
 * 通过fs-extra模块，将.next/static目录下的文件复制到.next/standalone/.next/static目录下，避免shell命令平台差异导致命令不生效
 * */

const fs = require('fs-extra')
const path = require('path')

const sourceDir = path.join(__dirname, '.next/static')
const targetDir = path.join(__dirname, '.next/standalone/.next/static')

try {
  fs.copySync(sourceDir, targetDir)
} catch (error) { }

const publicDir = path.join(__dirname, 'public')
const targetPublicDir = path.join(__dirname, '.next/standalone/public')
try {
  fs.copySync(publicDir, targetPublicDir)
} catch (error) { }

const configPm2File = path.join(__dirname, 'ecosystem.config.js')
const rootDir = path.join(__dirname, '.next/standalone/ecosystem.config.js')
try {
  fs.copySync(configPm2File, rootDir)
} catch (error) {
  
}

/*
* 脚本命令 pm2 start server.js  --name histar --watch
*/
